package com.longdaji.decoration.data.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * Created by longtao on 2018/4/1.
 */

public class AddressBean {
    private List<Address> address;

    public List<Address> getAddress() {
        return address;
    }

    public void setAddress(List<Address> address) {
        this.address = address;
    }

    public static class Address implements Parcelable {
        private String userid;
        private String contactPerson;
        private String contactTelephone;
        private String province;
        private String city;
        private String district;
        private String street;
        private String detailAddress;
        private String defaultAddress;
        private String simpleAddress;
        private int shippingId;
        private String zipcode;
        private String delFlag;


        protected Address(Parcel in) {
            userid = in.readString();
            contactPerson = in.readString();
            contactTelephone = in.readString();
            province = in.readString();
            city = in.readString();
            district = in.readString();
            street = in.readString();
            detailAddress = in.readString();
            defaultAddress = in.readString();
            shippingId = in.readInt();
            zipcode = in.readString();
            delFlag = in.readString();
            simpleAddress = in.readString();
        }

        public String getSimpleAddress() {
            StringBuilder sb = new StringBuilder();
            if (province != null) {
                sb.append(province);
            }
            if (city != null) {
                sb.append(city);
            }
            if (district != null) {
                sb.append(district);
            }
            if (street != null) {
                sb.append(street);
            }
            simpleAddress = sb.toString();
            return simpleAddress;
        }

        public void setSimpleAddress(String simpleAddress) {
            this.simpleAddress = simpleAddress;
        }

        public static final Creator<Address> CREATOR = new Creator<Address>() {
            @Override
            public Address createFromParcel(Parcel in) {
                return new Address(in);
            }

            @Override
            public Address[] newArray(int size) {
                return new Address[size];
            }
        };

        public String getProvince() {
            return province;
        }

        public void setProvince(String province) {
            this.province = province;
        }

        public String getCity() {
            return city;
        }

        public void setCity(String city) {
            this.city = city;
        }

        public String getDistrict() {
            return district;
        }

        public void setDistrict(String district) {
            this.district = district;
        }

        public String getStreet() {
            return street;
        }

        public void setStreet(String street) {
            this.street = street;
        }

        public String getUserid() {
            return userid;
        }

        public void setUserid(String userid) {
            this.userid = userid;
        }

        public String getContactPerson() {
            return contactPerson;
        }

        public void setContactPerson(String contactPerson) {
            this.contactPerson = contactPerson;
        }

        public String getContactTelephone() {
            return contactTelephone;
        }

        public void setContactTelephone(String contactTelephone) {
            this.contactTelephone = contactTelephone;
        }

        public String getDetailAddress() {
            return detailAddress;
        }

        public void setDetailAddress(String detailAddress) {
            this.detailAddress = detailAddress;
        }

        public String getDefaultAddress() {
            return defaultAddress;
        }

        public void setDefaultAddress(String defaultAddress) {
            this.defaultAddress = defaultAddress;
        }

        public int getShippingId() {
            return shippingId;
        }

        public void setShippingId(int shippingId) {
            this.shippingId = shippingId;
        }

        public String getZipcode() {
            return zipcode;
        }

        public void setZipcode(String zipcode) {
            this.zipcode = zipcode;
        }

        public String getDelFlag() {
            return delFlag;
        }

        public void setDelFlag(String delFlag) {
            this.delFlag = delFlag;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(userid);
            parcel.writeString(contactPerson);
            parcel.writeString(contactTelephone);
            parcel.writeString(province);
            parcel.writeString(city);
            parcel.writeString(district);
            parcel.writeString(street);
            parcel.writeString(detailAddress);
            parcel.writeString(defaultAddress);
            parcel.writeInt(shippingId);
            parcel.writeString(zipcode);
            parcel.writeString(delFlag);
            parcel.writeString(simpleAddress);
        }
    }
}
